//
//  XMCallDiscountTipView.m
//  XunMi
//
//  Created by MacBook on 2024/5/17.
//  Copyright © 2024 TieZhu. All rights reserved.
//

#import "XMCallDiscountTipView.h"

@implementation XMCallDiscountTipView

- (void)setDiscount:(NSString *)discount {
    _discount = discount;
    NSString *str = kStringFormat(@"你有一张%@确定在接通后使用吗？", discount);
    NSMutableAttributedString *aStr = [[NSMutableAttributedString alloc] initWithString:str];
    
    [aStr addAttributes:@{NSForegroundColorAttributeName:kHEX(@"#F83953"), NSFontAttributeName:[UIFont fontWithName:@"PingFangSC-Medium" size:14]} range:[str rangeOfString:discount]];
    
    NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
    paragraphStyle.alignment = NSTextAlignmentCenter;
    paragraphStyle.lineSpacing = 8;
    [aStr addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, aStr.length)];
    self.descLa.attributedText = aStr;
}

- (IBAction)left:(id)sender {
    if (self.leftBlock) {
        self.leftBlock();
    }
}

- (IBAction)right:(id)sender {
    if (self.rightBlock) {
        self.rightBlock();
    }
}

@end
